package jay.home.templates;

import java.util.*;
import jay.home.utils.*;

public class ActionFormTemplate
{
  protected static String nl;
  public static synchronized ActionFormTemplate create(String lineSeparator)
  {
    nl = lineSeparator;
    ActionFormTemplate result = new ActionFormTemplate();
    nl = null;
    return result;
  }

  protected final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl;
  protected final String TEXT_1 = "package jay.home.bet.web.struts;" + NL + "" + NL + "import java.util.List;" + NL + "import javax.servlet.http.HttpServletRequest;" + NL + "import org.apache.struts.action.ActionMapping;" + NL + "" + NL + "/**" + NL + " * ��b��" + NL + " */" + NL + "public class ";
  protected final String TEXT_2 = "ActionForm extends BaseActionForm" + NL + "{" + NL + "\tpublic void doValidate(ActionMapping mapping, HttpServletRequest request, List errors)" + NL + "\t{" + NL + "//\t\terrors.add(\"error message\");" + NL + "\t}" + NL + "\t" + NL + "\tpublic void reset(ActionMapping mapping, HttpServletRequest request)" + NL + "\t{" + NL + "//\t\treset the field's values" + NL + "\t}" + NL + "}";
  protected final String TEXT_3 = NL;

  public String generate(Object argument)
  {
    final StringBuffer stringBuffer = new StringBuffer();
    
  String form = (String)argument;

    stringBuffer.append(TEXT_1);
    stringBuffer.append(StringUtils.capitalize(form));
    stringBuffer.append(TEXT_2);
    stringBuffer.append(TEXT_3);
    return stringBuffer.toString();
  }
}
